/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2012
 */

package com.tech15.pub.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.tech15.pub.model.*;
import com.tech15.pub.dao.*;
import com.tech15.pub.service.*;
import com.tech15.pub.vo.query.*;

/**
 * @author 胡作正 email:zuozhenghu@sina.com
 * @version 1.0
 * @since 1.0
 */


@Entity
@Table(name = "PRIVATE_LOG")
public class PrivateLog extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "个人日志";
	public static final String ALIAS_ID = "序号";
	public static final String ALIAS_TITLE = "标题";
	public static final String ALIAS_CONTENT = "内容";
	public static final String ALIAS_USERID = "用户";
	public static final String ALIAS_YGXM = "员工姓名";
	public static final String ALIAS_SJ = "时间";
	
	//date formats
	public static final String FORMAT_SJ = DATE_TIME_FORMAT;
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 序号       db_column: ID 
     */ 	
	@Length(max=32)
	private java.lang.String id;
    /**
     * 标题       db_column: TITLE 
     */ 	
	@Length(max=200)
	private java.lang.String title;
    /**
     * 内容       db_column: CONTENT 
     */ 	
	@Length(max=800)
	private java.lang.String content;
    /**
     * 用户       db_column: USERID 
     */ 	
	
	private Long userid;
    /**
     * 员工姓名       db_column: YGXM 
     */ 	
	@Length(max=30)
	private java.lang.String ygxm;
    /**
     * 时间       db_column: SJ 
     */ 	
	
	private java.util.Date sj;
	//columns END


	public PrivateLog(){
	}

	public PrivateLog(
		java.lang.String id
	){
		this.id = id;
	}

	

	public void setId(java.lang.String value) {
		this.id = value;
	}
	
	@Id @GeneratedValue(generator="custom-id")
	@GenericGenerator(name="custom-id", strategy = "uuid.hex")
	@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, length = 32)
	public java.lang.String getId() {
		return this.id;
	}
	
	@Column(name = "TITLE", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getTitle() {
		return this.title;
	}
	
	public void setTitle(java.lang.String value) {
		this.title = value;
	}
	
	@Column(name = "CONTENT", unique = false, nullable = true, insertable = true, updatable = true, length = 800)
	public java.lang.String getContent() {
		return this.content;
	}
	
	public void setContent(java.lang.String value) {
		this.content = value;
	}
	
	@Column(name = "USERID", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getUserid() {
		return this.userid;
	}
	
	public void setUserid(Long value) {
		this.userid = value;
	}
	
	@Column(name = "YGXM", unique = false, nullable = true, insertable = true, updatable = true, length = 30)
	public java.lang.String getYgxm() {
		return this.ygxm;
	}
	
	public void setYgxm(java.lang.String value) {
		this.ygxm = value;
	}
	
	@Transient
	public String getSjString() {
		return DateConvertUtils.format(getSj(), FORMAT_SJ);
	}
	public void setSjString(String value) {
		setSj(DateConvertUtils.parse(value, FORMAT_SJ,java.util.Date.class));
	}
	
	@Column(name = "SJ", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public java.util.Date getSj() {
		return this.sj;
	}
	
	public void setSj(java.util.Date value) {
		this.sj = value;
	}
	
	

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("Title",getTitle())
			.append("Content",getContent())
			.append("Userid",getUserid())
			.append("Ygxm",getYgxm())
			.append("Sj",getSj())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof PrivateLog == false) return false;
		if(this == obj) return true;
		PrivateLog other = (PrivateLog)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
	
	private String sjBegin;

	@Transient
	public String getSjBegin() {
		return sjBegin;
	}

	public void setSjBegin(String sjBegin) {
		this.sjBegin = sjBegin;
	}
	
}

